﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace _70C
{
    //http://localhost:16891/index.aspx#/scene/create/1368826?pageId=1
    public partial class index : System.Web.UI.Page
    {
        /// <summary>
        /// 取得网站根目录的物理路径
        /// </summary>
        /// <returns></returns>
        public static string GetRootPath()
        {
            string AppPath = "";
            HttpContext HttpCurrent = HttpContext.Current;
            if (HttpCurrent != null)
            {
                AppPath = HttpCurrent.Server.MapPath("~");
            }
            else
            {
                AppPath = AppDomain.CurrentDomain.BaseDirectory;
                if (Regex.Match(AppPath, @"\\$", RegexOptions.Compiled).Success)
                    AppPath = AppPath.Substring(0, AppPath.Length - 1);
            }
            return AppPath;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //nr sortable ng-scope  动画溢出  处理   overflow: hidden;

            if (Request.QueryString["op"] == "login")//登陆
            {
                Response.Write("{\"code\":200,\"list\":null,\"map\":null,\"msg\":\"操作成功\",\"obj\":{\"email\":null,\"headImg\":null,\"id\":817122,\"idNum\":null,\"idPhoto\":null,\"loginName\":\"28D8D084D4BE19FFE62115BBDAC50266\",\"name\":\"无边宇宙\",\"phone\":\"\",\"qq\":\"\",\"regTime\":1419493820000,\"roleIdList\":[],\"sex\":0,\"status\":0,\"tel\":null,\"type\":0,\"xd\":0,\"property\":\"{\\\"myTplId\\\":1177827}\"},\"success\":true}");
                Response.End();
            }
            else if (Request.QueryString["op"] == "getAs")//当前模板所有页面
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json/getAs.json");
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "GetAllCategory")//获取所有模板分类
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json/GetAllCategory.json");
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "templatelist")//获取所有模板
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json/templatelist.json");
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "scenedesign")//获取单页详情
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json/scenedesign.json");
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "changePageSort")//调整页面顺序
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json/changePageSort.json");
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "my")//
            {
                Response.Write("{\"success\":true,\"code\":200,\"msg\":\"操作成功\",\"list\":[]}");
                Response.End();
            }
            else if (Request.QueryString["op"] == "GetCategory")//获取模板分类
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json/GetCategory.json");
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "sysFileList")//系统图片库
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json/sysFileList.json");
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "pageTpl")//更换页面模板
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json/pageTpl.json");
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "userList")//我的音乐
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json/userList.json");
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "customlist")//我的页面模板
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json/customlist.json");
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "scenesave")//切换编辑页
            {
                Response.Write("{\"success\":true,\"code\":200,\"msg\":\"操作成功\",\"obj\":null,\"map\":null,\"list\":null}");
                Response.End();
            }
            else if (Request.QueryString["op"] == "createPage")//新增页面
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json/createPage.json");
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "delPage")//删除页面
            {
                Response.Write("{\"success\":true,\"code\":200,\"msg\":\"操作成功\",\"obj\":null,\"map\":null,\"list\":null}");
                Response.End();
            }
            else if (Request.QueryString["op"] == "mysave")//把页面添加到我的
            {
                Response.Write("{\"success\":true,\"code\":200,\"msg\":\"操作成功\",\"obj\":1177827,\"map\":null,\"list\":null}");
                Response.End();
            }
            else if (Request.QueryString["op"] == "GetTradeType")//页面设置
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json/GetTradeType.json");
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "GetSceneDetial")//页面设置
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json/GetSceneDetial.json");
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "sceneTransition")//切换
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json/sceneTransition.json");
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "sys")
            {
                Response.Write("{\"success\":true,\"code\":200,\"msg\":\"操作成功\",\"obj\":null,\"map\":null,\"list\":[]}");
                Response.End();
            }
        }
    }
}